﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class BalanceCenter_MessageBoard : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (_User.isSurrogate==true)
        {
            this.rbFiliale.Visible = false;
        }
    }

    #region Web 窗体设计器生成的代码

    override protected void OnInit(EventArgs e)
    {
        isRequestLogin = true;
        SecondLevelPassword = true;
        RequestLoginPage = "BalanceCenter/MessageBoard.aspx";

        base.OnInit(e);
    }

    #endregion

    protected void g_PageIndexChanged(object sender, System.EventArgs e)
    {
        //  BindData();
    }

    protected void btnOK_Click(object sender, System.EventArgs e)
    {
        if (tbTitle.Text.Trim() == "")
        {
            ShoveEL._Web.JavaScript.Alert(this.Page, "请输入标题。");
            return;
        }

        if (tbContent.Text.Trim() == "")
        {
            ShoveEL._Web.JavaScript.Alert(this.Page, "请输入留言内容。");
            return;
        }
        long to_UserId = 0;

        if (this.rbFiliale.Checked)
        {
            to_UserId = _User.CommendID;

        }
        else
        {
            to_UserId = 1;
        }

        if (DAL.Tables.T_MessageBoard.Insert(_User.ID, true, to_UserId, true, DateTime.Now, true, tbTitle.Text.Trim(), true, ShoveEL._String.Compress(tbContent.Text), true, DateTime.Now, false, ShoveEL._String.Compress("a"), false, System.Web.HttpContext.Current.Request.UserHostAddress, true, 0, false) < 0)
        {
            PublicFunction.GoError(ErrorNumber.DataReadWrite, "数据读写错误", this.GetType().BaseType.FullName);

            return;
        }

        tbTitle.Text = "";
        tbContent.Text = "";
        //BindData();
        ShoveEL._Web.JavaScript.Alert(this.Page, "留言成功。");
    }
}
